using System.Collections;
using System.Collections.Generic;
using Cysharp.Threading.Tasks;
using UnityEngine;

namespace FpFrame
{

    [CreateAssetMenu(menuName = "FpFrame/Loader/ABLoader")]
    public class ABLoader : AssetLoaderSo
    {
        private AssetBundle bundle;

        public override T Load<T>(string path) 
        {
            if (bundle == null)
                bundle = AssetBundle.LoadFromFile(path);

            return bundle.LoadAsset<T>(path);
        }

        public override UniTask<T> LoadAsync<T>(string path)
        {
            throw new System.NotImplementedException();
        }

        public override void Unload(string path)
        {
            bundle?.Unload(false);
        }

        public override List<string> GetAllPathsInFolder(string folderPath)
        {
            throw new System.NotImplementedException();
        }
    }
}